import axios from 'axios';
import qs from 'qs';
import store from 'store2';
const apiUrl='http://47.101.143.200:80';
const imgUrl='http://47.101.143.200:80';
// const apiUrl='http://122.112.235.125:3000';
// const imgUrl='http://122.112.235.125:3000';
// const devUrl = 'http://127.0.0.1:8080';
// const proUrl = 'http://apiUrl.com';
axios.defaults.baseURL=apiUrl;

//解决cookie跨域
axios.defaults.withCredentials=true;

//解决编码问题（传输数据需要字符串格式）
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.transformRequest=function(data,header){
    return qs.stringify(data);
}


export default {
  // apiUrl : process.env.NODE_ENV=='development' ? devUrl : proUrl,
  // apiPrefix : "api",
  // gitHub : 'https://github.com/xusenlin/ElementUIAdmin2'
  install(Vue,options){
        Vue.prototype.apiUrl=apiUrl;
        Vue.prototype.imgUrl=imgUrl;
        Vue.prototype.axios=axios;
        Vue.prototype.store=store;
    }
}

